package com.chinaisafe.user.mapper;
import java.util.Collection;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.chinaisafe.user.vo.response.LoginTenantTreeVO;
import org.apache.ibatis.annotations.Param;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper;
import com.chinaisafe.user.vo.response.SysTenantRespVO;
import com.chinaisafe.user.entity.SysTenant;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;
import java.util.Set;

/**
 * SysTenantMapper
 * Description：租户Mapper接口
 *
 * @author xuefu.shu
 * @date 2024-07-12 10:22:08
 */
@Mapper
public interface SysTenantMapper extends BaseMapper<SysTenant> {
    /**
     * 根据条件获取租户分页列表
     * @param page 分页对象
     * @param queryWrapper 筛选参数
     * @return IPage<SysTenantRespVO> 查询结果
     * @author xuefu.shu
     * @date 2024-07-12 10:22:08
     */
    IPage<SysTenantRespVO> getPageList(Page<SysTenant> page, @Param(Constants.WRAPPER) QueryWrapper<SysTenant> queryWrapper);


    /**
     * 根据账号id获取租户id
     * @param id
     * @return List
     * @author xuefu.shu
     * @date 2024-07-15 10:15
     */
    Set<SysTenant> findIdByAccountId(@Param("id")Long id);

    /**
     * 根据租户id集合获取租户id
     * @param ids
     * @return List
     * @author xuefu.shu
     * @date 2024-07-15 10:23
     */
    Set<Long> findTopIdByIdIn(@Param("ids")Collection<Long> ids);

    /**
     * 根据租户id集合获取租户id
     * @param topIds
     * @return
     * @author xuefu.shu
     * @date 2024-07-15 10:31
     */
    List<LoginTenantTreeVO> findByTopIdIn(@Param("topIds")Collection<Long> topIds);

}
